Skip to content

[9.3](backport #52005) [beatreceiver][packetbeat] Delegate shutdown_timeout logic to libbeat - #52267

Draft
mergify[bot] wants to merge 2 commits into
9.3from
mergify/bp/9.3/pr-52005
Draft

[9.3](backport #52005) [beatreceiver][packetbeat] Delegate shutdown_timeout logic to libbeat#52267
mergify[bot] wants to merge 2 commits into
9.3from
mergify/bp/9.3/pr-52005

Conversation

@mergify

@mergify mergify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Proposed commit message

This PR delegatesshutdown_timeout logic to libbeat. It stays consistent with how other beats also handle the same.

This is also required so that we do not wait for shutdown_timeout period every time the config is validated here

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

None

Will also close #52031


This is an automatic backport of pull request #52005 done by Mergify.

…#52005)

* [beatreceiver] Delegate shutdown_timeout logic to libbeat

(cherry picked from commit 663f454)

# Conflicts:
#	packetbeat/beater/packetbeat.go
#	packetbeat/beater/processor.go
@mergify
mergify Bot requested a review from a team as a code owner July 27, 2026 07:03
@mergify mergify Bot added backport conflicts There is a conflict in the backported pull request labels Jul 27, 2026
@mergify

mergify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Cherry-pick of 663f454 has failed:

On branch mergify/bp/9.3/pr-52005
Your branch is up to date with 'origin/9.3'.

You are currently cherry-picking commit 663f45459.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   packetbeat/config/config.go
	modified:   packetbeat/tests/system/config/packetbeat.yml.j2
	modified:   packetbeat/tests/system/test_0060_flows.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   packetbeat/beater/packetbeat.go
	both modified:   packetbeat/beater/processor.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • /test : Run the Buildkite pipeline.

@github-actions github-actions Bot added Team:Security-Linux Platform Linux Platform Team in Security Solution skip-changelog labels Jul 27, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 27, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform)

@mergify

mergify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

This pull request has not been merged yet. Could you please review and merge it @khushijain21? 🙏

@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

The Buildkite failure is caused by unresolved cherry-pick conflict markers committed in packetbeat/beater/packetbeat.go and packetbeat/beater/processor.go. Resolve the backport conflicts and push a commit without <<<<<<<, =======, or >>>>>>> markers; both failing jobs should then proceed past formatting and pre-commit.

Remediation

  • Resolve the conflicts in packetbeat/beater/packetbeat.go:100-111 and packetbeat/beater/processor.go:52-69, preserving the intended shutdown_timeout delegation and the 9.3 branch behavior.
  • Remove all conflict-marker lines and verify the resolved files compile.
  • Re-run make -C packetbeat check update, make check-no-changes, and pre-commit run --all-files.
Investigation details

Root Cause

This backport contains the literal Git conflict markers from the failed cherry-pick. The PR diff shows markers in both files: packetbeat.go has <<<<<<< HEAD through >>>>>>> 663f45459, while processor.go has the same markers around incompatible processor field definitions.

Evidence

Verification

Not run locally; the supplied CI logs fail during formatting and pre-commit before tests execute.

Follow-up

The PR already has a conflicts label and an earlier Mergify comment identifying the failed cherry-pick; this Buildkite failure confirms those unresolved files were committed to the branch.


What is this? | From workflow: PR Buildkite Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Adapt #52005 to 9.3 by adding Beat.ShutdownTimeout for the beater
assignment and switching the processor flush wait to publish_timeout,
without pulling main-only logger changes.

Assisted-By: Composer
Co-authored-by: Cursor <cursoragent@cursor.com>
@khushijain21

Copy link
Copy Markdown
Contributor

Resolved the cherry-pick conflicts and pushed.

9.3 adaptation: #51136 (libbeat drain watchdog / Beat.ShutdownTimeout) is not on 9.3, so this adds the Beat.ShutdownTimeout field for the beater assignment (forward-compatible). Processor flush wait uses publish_timeout so CheckConfig no longer blocks on shutdown_timeout. Kept existing status-reporter APIs; did not pull main-only logger changes from #51631.

Packetbeat beater/config compile cleanly locally.

@khushijain21
khushijain21 requested a review from a team as a code owner July 27, 2026 09:33
@khushijain21
khushijain21 requested review from belimawr and orestisfl and removed request for a team July 27, 2026 09:33
@khushijain21
khushijain21 marked this pull request as draft July 27, 2026 09:38
@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

The golangci-lint Ubuntu job failed on four Packetbeat diagnostics in packetbeat/beater/packetbeat.go and packetbeat/beater/processor.go. Update the PR-head code to use the beat logger, WaitGroup.Go, and the non-deprecated manager lifecycle before rerunning the check.

Remediation

  • Replace the two logp.L() calls in packetbeat/beater/packetbeat.go with the injected b.Info.Logger (Warnw for the diagnostic hook and Warn for pipelinesWarning).
  • Simplify processor.Start in packetbeat/beater/processor.go to use p.wg.Go(func() { ... }), removing the separate Add(1)/Done() pattern.
  • Replace b.Manager.Start() in runManaged with b.Manager.PreInit() error handling followed by b.Manager.PostInit(), matching the existing Packetbeat lifecycle pattern.
  • Rerun the golangci-lint check on the updated branch.
Investigation details

Root Cause

The PR head introduces or exposes four lint violations in the touched Packetbeat files: forbidden global logger usage, the waitgroupgo modernization rule, and a deprecated manager API.

Evidence

  • Workflow: https://github.com/elastic/beats/actions/runs/30254464857
  • Job/step: lint (ubuntu-latest) / golangci-lint (job 89939705358)
  • Key log excerpt: packetbeat/beater/packetbeat.go:166:6: use of logp.L forbidden; packetbeat/beater/packetbeat.go:183:4: use of logp.L forbidden; packetbeat/beater/processor.go:81:2: waitgroupgo: Goroutine creation can be simplified using WaitGroup.Go; packetbeat/beater/packetbeat.go:226:12: SA1019: b.Manager.Start is deprecated: Use [PreInit] and [PostInit] instead.
  • The job reports 4 issues and issues found; macOS and Windows were cancelled after the Ubuntu failure.

Validation

Not run locally; this report is based on the failed workflow logs and PR-head source.

Follow-up

The earlier detective report on this PR covered unresolved cherry-pick conflict markers in Buildkite. This report covers a different failure in the subsequent golangci-lint run.


What is this? | From workflow: PR Actions Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts There is a conflict in the backported pull request skip-changelog Team:Security-Linux Platform Linux Platform Team in Security Solution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant